<?php
//微信端路由

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/
Route::get('/login', [\App\Http\Controllers\Wx\UserController::class, 'login'])->name('wx.index');

Route::get('/coupon/getstockinfo', [\App\Http\Controllers\Wx\CouponController::class, 'getStockInfo']);
//Route::get('/coupon/distribute_coupon', [\App\Http\Controllers\Wx\CouponController::class, 'distributeCoupon']);

Route::get('/user/getuser', [\App\Http\Controllers\Wx\UserController::class, 'getUser']);
Route::get('/options', [\App\Http\Controllers\Wx\OptionController::class, 'index']);


//$api->get('/v1/csg.community.communitysubject.join', 'CommSubController@joinCommunityOrSubject');//加入社区或者话题

//消费券核销回调通知
Route::post('/coupon/userconsumecallback', [\App\Http\Controllers\Wx\CouponController::class, 'userconsumecallback']);
//补贴到账结果回调通知
Route::post('/subsidy/usertransfercallback', [\App\Http\Controllers\Wx\SubsidyController::class, 'userTransferCallback']);
Route::post('/restaurant/upload_pic', [\App\Http\Controllers\Wx\RestaurantController::class, 'uploadPic']);

Route::middleware(['auth:sanctum', 'rbac.check'])->group(function () {
    //用户认证领取
    Route::get('/user/authreceive', [\App\Http\Controllers\Wx\UserController::class, 'userAuthReceive']);
    Route::get('/user/auth_result', [\App\Http\Controllers\Wx\UserController::class, 'authResult']);
    Route::get('/user/check_qrcode', [\App\Http\Controllers\Wx\UserController::class, 'checkQrCode']);
    Route::post('/user/used_qrcode', [\App\Http\Controllers\Wx\UserController::class, 'usedQrCode']);
    //获取微信token
    Route::get('/user/getwxtoken', [\App\Http\Controllers\Wx\UserController::class, 'getWxToken']);
    //保存用户身份校验信息
    Route::post('/user/saveuserreal', [\App\Http\Controllers\Wx\UserController::class, 'saveUserReal']);
    //获取用户活动领取时展示验证信息
    Route::get('/user/verifyuserreceiveshow', [\App\Http\Controllers\Wx\UserController::class, 'verifyUserReceiveShow']);
    //用户券列表
    Route::get('/user/couponlist', [\App\Http\Controllers\Wx\CouponController::class, 'userCouponList']);
    //券详情
    Route::get('/user/coupondetail', [\App\Http\Controllers\Wx\CouponController::class, 'couponDetail']);
    //设置券过期通知状态
    Route::post('/user/setcouponexpirenotice', [\App\Http\Controllers\Wx\UserController::class, 'setCouponExpireNotice']);

    // 受助者
    Route::get('/receiver/info', [\App\Http\Controllers\Wx\ReceiverController::class, 'info']);

    // 餐厅
    Route::get('/restaurant/detail', [\App\Http\Controllers\Wx\RestaurantController::class, 'detail']);
    Route::post('/restaurant/save', [\App\Http\Controllers\Wx\RestaurantController::class, 'save']);
    Route::get('/restaurant/statistics', [\App\Http\Controllers\Wx\RestaurantController::class, 'statistics']);
    Route::get('/restaurant/not_settlement', [\App\Http\Controllers\Wx\RestaurantController::class, 'getDinnerLogNotSettlementByRestaurantId']);
    Route::get('/restaurant/settlemented', [\App\Http\Controllers\Wx\RestaurantController::class, 'getDinnerLogSettlementedByRestaurantId']);

    // 餐厅管理员
    Route::post('/restaurant_manage/get_sms_code', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'getSmsCode']);
    Route::post('/restaurant_manage/login', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'login']);
    Route::post('/restaurant_manage/add', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'add']);
    Route::post('/restaurant_manage/delete', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'delete']);
    Route::get('/restaurant_manage/list', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'list']);
    Route::get('/restaurant_manage/dinnerlist', [\App\Http\Controllers\Wx\RestaurantManageController::class, 'dinnerLogList']);

    //活动列表
    Route::get('/activity/restaurant_apply_desc', [\App\Http\Controllers\Wx\ActivityController::class, 'getRestaurantApplyDesc']);
    Route::get('/activity/list', [\App\Http\Controllers\Wx\ActivityController::class, 'list']);
    //活动详情
    Route::get('/activity/detail', [\App\Http\Controllers\Wx\ActivityController::class, 'detail']);
    //活动领取失败展示
    Route::get('/activity/receivefail', [\App\Http\Controllers\Wx\ActivityController::class, 'receiveFail']);

    //补贴活动，用户认证领取
    Route::post('/user/userauthreceivesubsidy', [\App\Http\Controllers\Wx\UserController::class, 'userAuthReceiveSubsidy']);
    //补贴活动 用户领取是展示验证信息
    Route::get('/user/verifyuserreceivesubsidyshow', [\App\Http\Controllers\Wx\UserController::class, 'verifyUserReceiveSubsidyShow']);


});
